<script src="{{ getAssets }}js/amazeui.datatables.min.js?v={{ assets_version }}"></script>
<script src="{{ getAssets }}js/jquery.table2excel.min.js?v={{ assets_version }}"></script>
<script>
var tables = $('#dataTables').DataTable({
    "sAjaxSource" : ''
    ,"bLengthChange": false
    ,"fnServerData" : function(sSource, aoData, fnCallback) {
        var params = checkQueryTableData(aoData);
        $.post(sSource, JSON.stringify(params),function(resp) {
            isLoading = true;
            fnCallback(resp);
        },'json')
    }
    ,columns: [
        {"mDataProp" : "Id", "bSortable": false}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return productTypeidName(full.Products.TypeId);
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return productGroupName(full.Products);
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.sph;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.cyl;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.add;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.model;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.color;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.size;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.function_info;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.film_color;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.genre;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Products.Spec;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Acceptance.lot_number;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Acceptance.manufacture_date > 0 ? timetransDate(full.Acceptance.manufacture_date) : '';
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Acceptance.expiry_date > 0 ? timetransDate(full.Acceptance.expiry_date) : '';
            }}
        ,{"data" : "StorageNum", "bSortable": false}
    ]
    ,"serverSide": true
    ,"bPaginate" : false
    ,"bFilter" : false	//是否启动过滤、搜索功能
    ,"bInfo" : false //是否显示页脚信息，DataTables插件左下角显示记录数
    ,"bProcessing" : true //DataTables载入数据时，是否显示‘进度’提示
});
var isLoading = false;
$('#download').bind("click", function(){
    if(isLoading) {
        $("#dataTables").table2excel({

            exclude: ".noExl",

            name: "导出入库明细",

            filename: "xz_rkmx",

            fileext: ".xls",

            exclude_img: false,

            exclude_links: false,

            exclude_inputs: false
        });
    } else {
        $("#searchsubmit").click();
        layer.msg("还没加载结束请耐心等待一下！");return false;
    }
    return false;
});

</script>